package com.hotelManagerSystem.service.impl;

import com.hotelManagerSystem.model.Permission;
import com.hotelManagerSystem.model.RolePermission;
import com.hotelManagerSystem.mapper.RolePermissionMapper;
import com.hotelManagerSystem.service.IRolePermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  角色--权限 服务实现类
 * </p>
 *
 * @author longyajr
 * @since 2021-12-22
 */
@Service
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper, RolePermission> implements IRolePermissionService {
    @Autowired
    private RolePermissionMapper rolePermissionMapper;
    @Override
    public boolean deleteRolePermissionByRoleId(int roleId) {
        return rolePermissionMapper.deleteRolePermissionByRoleId(roleId);
    }

    /**
     * @author treasy
     * @param staffId
     * @return
     */
    @Override
    public List<Permission> queryAllPermissionByStaffId(int staffId) {
        return rolePermissionMapper.queryAllPermissionByStaffId(staffId);
    }

    /**
     * @author treasy
     * @param permissionId
     * @return
     */
    @Override
    public boolean deleteByPermissionId(int permissionId) {
        return rolePermissionMapper.deleteByPermissionId(permissionId);
    }
}
